{extend name="extra@admin/content"}
{block name="content"}
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="__SELF__" data-auto="true" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">原料名称</label>
        <div class="layui-input-block">
            {if $vo and isset($vo.title)}
            <input name="name" value='{$vo.name|default=""}'
                   required="required" title="请输入原料名称" placeholder="请输入原料名称" class="layui-input ">
            {else}
            <input name="name" value='{$vo.name|default=""}' required="required" 
                   title="请输入原料名称" class="layui-input">
            {/if}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属分类</label>
        <div class="layui-input-block">
            <select name="cat_id" lay-verify="" lay-search>
                {volist name='list' id='v'}
                {if $vo and isset($vo.title)}
                    <option value="{$v.id}" {if condition="$vo['cat_id'] eq $v['id']"} selected {/if}>{$v.name}</option>
                {else}
                    <option value="{$v.id}" >{$v.name}</option>
                {/if}
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">预警库存</label>    
        <div class="layui-input-block">
            {if $vo and isset($vo.warn_stock)}
            <input name="warn_stock" value='{$vo.warn_stock|default=""}'
                   required="required" title="请输入预警库存" placeholder="请输入预警库存" class="layui-input ">
            {else}
            <input name="warn_stock" value='{$vo.warn_stock|default=""}' required="required" 
                   title="请输入预警库存" class="layui-input">
            {/if}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">基本计量数</label>
        <div class="layui-input-block">
            {if $vo and isset($vo.pack)}
            <input name="spec" value='{$vo.spec|default=""}'
                   required="required" title="请输入基本计量数" placeholder="请输入基本计量数" class="layui-input ">
            {else}
            <input name="spec" value='{$vo.spec|default=""}' required="required" 
                   title="请输入基本计量数" class="layui-input">
            {/if}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单位</label>
        <div class="layui-input-block">
            {if $vo and isset($vo.unit)}
            <input name="unit" value='{$vo.unit|default=""}'
                   required="required" title="请输入单位" placeholder="请输入单位" class="layui-input ">
            {else}
            <input name="unit" value='{$vo.unit|default=""}' required="required" 
                   title="请输入单位" class="layui-input">
            {/if}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">包装</label>
        <div class="layui-input-block">
            {if $vo and isset($vo.pack)}
            <input name="pack" value='{$vo.pack|default=""}'
                   required="required" title="请输入包装" placeholder="请输入包装" class="layui-input ">
            {else}
            <input name="pack" value='{$vo.pack|default=""}' required="required" 
                   title="请输入包装" class="layui-input">
            {/if}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">允许自购</label>
        <div class="layui-input-block">
            {if $vo and isset($vo.pack)}
            <input type="radio"  name="is_zigou" value="0"  title="不允许" {if condition="$vo.is_zigou eq 0"} checked {/if}>
            <input type="radio"  name="is_zigou" value="1"  title="允许" {if condition="$vo.is_zigou eq 1"} checked {/if}>
            {else}
            <input type="radio"  name="is_zigou" value="0"  title="不允许"  checked >
            <input type="radio"  name="is_zigou" value="1"  title="允许" }>
            {/if}
            
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入备注，最多100个字符" maxlength="100" title="请输入备注" class="layui-textarea" name="remark">{$vo.remark|default=""}</textarea>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
        {if !isset($vo['addtime'])}<input type='hidden' value='{$time}' name='addtime'/>{/if}
        {if isset($vo['is_deleted'])}<input type='hidden' value='{$vo.is_deleted}' name='is_deleted'/>{else}<input type='hidden' value='0' name='is_deleted'/>{/if}
        {if isset($vo['stock'])}<input type='hidden' value='{$vo.stock}' name='stock'/>{else}<input type='hidden' value='0' name='stock'/>{/if}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>
    <script>window.form.render();</script>
</form>
{/block}